Some hacks to stop screen blanking.
authorElliot Lee <sopwith@src.gnome.org>
Wed, 9 Aug 2000 17:24:47 +0000 (17:24 +0000)
committerElliot Lee <sopwith@src.gnome.org>
Wed, 9 Aug 2000 17:24:47 +0000 (17:24 +0000)
Some hacks to stop screen blanking.

gdk/linux-fb/gdkinput-ps2.c
gdk/linux-fb/gdkmain-fb.c

index 1e96eabdef5e45f7d57a486280dbea159eaddb0d..38f6872babe2f1de15f08aa6eb7965b1147d60bd 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <linux/fb.h>
+
+/* Two minutes */
+#define BLANKING_TIMEOUT 120*1000
 
 /*
  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
@@ -64,6 +68,8 @@ typedef struct {
   gboolean caps_lock : 1;
 } Keyboard;
 
+static guint blanking_timer = 0;
+
 static Keyboard * tty_keyboard_open(void);
 static guint keyboard_get_state(Keyboard *k);
 
@@ -73,6 +79,37 @@ static Keyboard *keyboard = NULL;
 static guint multiclick_tag;
 static GdkEvent *multiclick_event = NULL;
 
+#ifndef VESA_NO_BLANKING
+#define VESA_NO_BLANKING        0
+#define VESA_VSYNC_SUSPEND      1
+#define VESA_HSYNC_SUSPEND      2
+#define VESA_POWERDOWN          3
+#endif
+
+#if 0
+static gboolean
+input_activity_timeout(gpointer p)
+{
+  blanking_timer = 0;
+  ioctl(gdk_display->fd, FBIOBLANK, VESA_POWERDOWN);
+  return FALSE;
+}
+#endif
+
+/* This is all very broken :( */
+static void
+input_activity(void)
+{
+#if 0
+  if(blanking_timer)
+    g_source_remove(blanking_timer);
+  else
+    gdk_fb_redraw_all();
+
+  blanking_timer = g_timeout_add(BLANKING_TIMEOUT, input_activity_timeout, NULL);
+#endif
+}
+
 static gboolean
 click_event_timeout(gpointer x)
 {
@@ -569,6 +606,8 @@ handle_mouse_input(MouseDevice *mouse, gboolean got_motion)
        gdk_window_unref(mouse->prev_window);
       mouse->prev_window = gdk_window_ref(win);
     }
+
+  input_activity();
 }
 
 static gboolean
@@ -1381,6 +1420,8 @@ handle_keyboard_input(GIOChannel *gioc, GIOCondition cond, gpointer data)
        }
     }
 
+  input_activity();
+
   return TRUE;
 }
 
index c81088fd719ecb051ecbcb367ef37a6407ca9d0d..ea1db80b57502cd143e93fb019be3ca5d3626206 100644 (file)
@@ -72,6 +72,7 @@ gdk_fb_display_new(const char *filename)
 
   retval = g_new0(GdkFBDisplay, 1);
   retval->fd = fd;
+  ioctl(retval->fd, FBIOBLANK, 0);
   n = ioctl(fd, FBIOGET_FSCREENINFO, &retval->sinfo);
   n |= ioctl(fd, FBIOGET_VSCREENINFO, &retval->modeinfo);
   g_assert(!n);